package com.jugheadzhou.auth.core.message;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * @author jugheadzhou
 * @date 2021-12-02
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class WsMessage implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 连接ID 全局唯一
     */
    private String connectionId;

    /**
     * websocket默认事件
     * 1. onOpen -> 连接创建
     * 2. onMessage -> 连接通信
     * 3. onClose -> 连接关闭
     * 4. onError -> 连接异常
     *
     * @see WsEvent
     */
    private String wsEvent = WsEvent.ON_MESSAGE.getName();

    /**
     * websocket通信业务事件
     *
     * eg.
     * 1. mrPrint -> 电子病历打印事件
     *
     * @see WsBusinessEvent
     */
    private String wsBusinessEvent;

    /**
     * 消息内容 (默认是json字符串)
     */
    private String content;


}
